import KZJRequest from '../index'
import { TRequestDefaultResult } from '../type'

enum Letters {
  mess = '/msg/private', // 歌曲
  comment = '/msg/comments',
  talk = '/msg/private/history',
  sentText = '/send/text'
}

export function getLetters(limit = 30, offset = 0) {
  return KZJRequest.get<TRequestDefaultResult>({
    url: Letters.mess,
    params: { limit, offset },
    showLoading: true,
    takeCookie: true
  })
}

export function getComment(uid: number, limit = 30) {
  return KZJRequest.get<TRequestDefaultResult>({
    url: Letters.comment,
    params: { limit, uid },
    showLoading: true,
    takeCookie: true
  })
}

export function getTalks(uid: number, limit = 30) {
  return KZJRequest.get<TRequestDefaultResult>({
    url: Letters.talk,
    params: { limit, uid },
    showLoading: true,
    takeCookie: true,
    immediately: true
  })
}

export function sentText(user_ids: number, msg: string) {
  return KZJRequest.get<TRequestDefaultResult>({
    url: Letters.sentText,
    params: { msg, user_ids },
    showLoading: true,
    takeCookie: true,
    immediately: true
  })
}
